package com.dcliu.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dcliu.bean.Customer;
import com.dcliu.service.CustomerService;

@Controller
@RequestMapping("/customer")
public class CustomerController {

	private static final Logger logger = LoggerFactory.getLogger(CustomerController.class);

	@Autowired
	private CustomerService demoService;
	
	@RequestMapping(value="/getCustomerByName/{name}",method = RequestMethod.GET)
	@ResponseBody
	public Customer getCustomerByName(@PathVariable String name){
		logger.info("i am coming.....");
		System.out.println("==================================");
		Customer customer = demoService.getInfoByName("dcliu0");
		System.out.println(customer.getUserName());
		System.out.println(customer.getUserPhone());
		System.out.println(customer.getUserEmail());
		System.out.println("==================================");
		return demoService.getInfoByName(name);
	}
}
